package com.pretty.test.controller.pets.blogcomment;


import com.baomidou.mybatisplus.extension.api.R;
import com.pretty.test.controller.pets.blogcomment.vo.CommentListVO;
import com.pretty.test.entity.PetsBlogComment;
import com.pretty.test.entity.PetsMessage;
import com.pretty.test.service.IPetsBlogCommentService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 博客评论控制器
 * @author dujianyu
 * @since 2021-04-21
 */
@RestController
@AllArgsConstructor
@RequestMapping("/blogcomment")
public class PetsBlogCommentController {
    private IPetsBlogCommentService service;

    /**
     * 根据博客ID得到评论列表
     * @param blogId
     */
    @GetMapping("/getCommentByBlogId")
    public R<List<CommentListVO>> getCommentByBlogId(String blogId){
        return R.ok(service.getCommentByBlogId(blogId));
    }

    /**
     * 新增或修改
     * @param petsBlogComment
     */
    @PostMapping("/submit")
    public R<Boolean> submit(@RequestBody PetsBlogComment petsBlogComment){
        return R.ok(service.saveOrUpdate(petsBlogComment));
    }
}
